package com.example.demo.com.java8.date;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;

/**
 * @author chengfei5
 * @date 2018/8/22
 */
public class TestSimpleDateFormat {
    public static void main(String[] args) throws ExecutionException, InterruptedException {

        //怎么改造成lambda？
        Callable<Date> task = new Callable<Date>() {
            @Override
            public Date call() throws Exception {
                return DateFormatThreadLocal.convert("20180822");
            }
        };
        //创建一个线程池
        ExecutorService pool = Executors.newFixedThreadPool(10);

        List<Future<Date>> results = new ArrayList<>();
        for(int i = 0;i<10;i++){
            results.add(pool.submit(task));
        }
        for(Future<Date> future:results){
            System.out.println(future.get());
        }

        pool.shutdown();
    }
}
